package com.dataaccess.dataaccess.web.service;


import cn.hutool.json.JSONObject;
import com.dataaccess.dataaccess.common.base.BaseService;
import com.dataaccess.dataaccess.support.model.RespEntity;
import com.dataaccess.dataaccess.support.utils.MyLogger;
import com.dataaccess.dataaccess.web.mapper.ElectricfireAlarmDeviceDataChangedMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class PostOrGetService extends BaseService {

    @Resource
    public MyLogger logger;

    @Resource
    ElectricfireAlarmDeviceDataChangedMapper electricfireAlarmDeviceDataChangedMapper;


    /**
     * 远程调用消防物联网模块，修改设备的离线状态
     * @param
     * @return
     */
    public RespEntity updateToOff(JSONObject jsonParam) {
        //处理支持form-data和json两种方式
        //jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
        logger.info("iot-------------updateToOff:"+jsonParam.toString());
        fireFightingiot(jsonParam,"firefightingiot","updateToOff","device");
        return RespEntity.success();
    }
    /**
     * 远程调用消防物联网模块，修改设备的在线状态状态
     * @param
     * @return
     */
    public RespEntity updateHEX100ToON(JSONObject jsonParam) {
        logger.info("iot-------------updateHEX100ToON:"+jsonParam.toString());
        fireFightingiot(jsonParam,"firefightingiot","updateToHEX100","device");
        return RespEntity.success();
    }
    /**
     * 远程调用消防物联网模块，修改设备的离线状态（水表平台）
     * @param
     * @return
     */
    public RespEntity updateMeterToOff(JSONObject jsonParam) {
        //处理支持form-data和json两种方式
        //jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
        logger.info("iot-------------updateToOff:"+jsonParam.toString());
        fireFightingiot(jsonParam,"data","meter_update_off","device");
        return RespEntity.success();
    }
}
